Changes the screen effect that is playing now into another one over so many frames. A day tint turns into night, a calm heat haze turns into a storm. overlay_change(nothing, frames) fades the effect away and then stops it; with no effect playing, the new one fades in. With frames at 0 it happens at once, like overlay_start and overlay_stop. Amounts such as See-through, Brightness, Blocks, Wobble, Stretch, Sky color and Tint blend smoothly from one effect to the other; what cannot be mixed fades out in the first half and the new one fades in during the second.
Works differently on Game Boy - The Game Boy starts the new screen effect at once; it does not blend the old effect into the new one over the frames. With nothing as the new effect, the old one fades away over the frames and then stops.
Works differently on Game Boy Color - The Game Boy Color starts the new screen effect at once; it does not blend the old effect into the new one over the frames. With nothing as the new effect, the old one fades away over the frames and then stops.
Works differently on Sega Genesis - The Sega Genesis plays overlay effects its own way. A change between the effects it plays (the whole screen toward one color) blends them when they go toward the same color and fades one out and the other in when they do not; an effect with another track is refused with a message that names the track. A call (with seconds) while a room change plays does nothing, as on the Advance. The Start and Stop Screen Effect steps of a cutscene that change over some seconds play this change.
On other consoles this differs: see Side by side and How the consoles differ.
overlay_change(effect, frames)| Name | Type |
|---|---|
effect | overlay |
frames | int |
Nothing.
Changes the screen effect that is playing now into another one over so many frames. A day tint turns into night, a calm heat haze turns into a storm. overlay_change(nothing, frames) fades the effect away and then stops it. If no effect is playing, the new one fades in from nothing. With frames at 0 it happens at once, exactly like overlay_start and overlay_stop.
Call it once, from any event. 60 frames are about a second.
A calm effect turning into night over two seconds:
overlay_start(ov_doc_day);
overlay_change(ov_doc_night, 120);Fading the effect away to a plain screen over half a second:
overlay_change(nothing, 30);Both effects keep playing on their own clocks while they change, and the screen shows the two together.
Calling overlay_change again in the middle of a change starts from what is on the screen, so nothing jumps. Up to three effects can be on their way at once; a fourth drops the one that is nearly gone.
effect has to be a screen effect. A text effect needs text_effect_change and a sprite effect sprite_effect_change.overlay_change does nothing until it is over. A room change ends the change, like it ends any screen effect.tween_to with an effect's strength instead; overlay_change does the straight line for you.A change needs no more of the console's 8 row-by-row effects than the bigger of the two effects needs (a room change keeps two for itself). While it runs, the player works the blended rows out again every frame (about 5 KB of the console's big, slow memory, once a game plays an overlay). A game that never calls overlay_change has none of this in its cartridge.
Each effect keeps playing on its own clock while it changes, and the screen is the sum of the two. These tracks blend row by row: See-through, Brightness (when both go toward the same color and no Shape shapes them), Blocks, Wobble, Stretch, Sky color and Tint (when both change the same color number). A track that only one of the two effects has fades with that effect’s half of the change, so it is gone by the middle (the old one) or starts at the middle (the new one). These cannot be mixed, so the old effect fades out in the first half and the new one fades in during the second: a Shape with its Scale and Rotate, a Brightness that goes toward black in one effect and toward white in the other, a Brightness with a color the other effect does not share, a See-through or Brightness that a Shape shapes, and everything of an effect with an Area. A change never needs more of the console’s 8 row-by-row effects than the larger of the two effects needs. Calling it again in the middle of a change starts from what is showing, so nothing jumps; up to three effects can be on their way at once. A room transition that is playing is left alone. A game that never calls it has none of this in its cartridge.